namespace devtm.Aop.Emit
{
    using System;
    using Mono.Cecil.Cil;
    

    [Serializable]
    public class EmitReturnMethodStatement : EmitStatement
    {
        private EmitExpression expression;

        public EmitReturnMethodStatement()
        {
        }

        public EmitReturnMethodStatement(EmitExpression expression)
        {
            this.Expression = expression;
        }

        public EmitExpression Expression
        {
            get
            {
                return this.expression;
            }
            set
            {
                this.expression = value;
            }
        }


        public override void Compile(CilWorker gen)
        {

            this.Expression.UserData.Add("way", "get");
            this.Expression.Compile(gen);
            this.Expression.UserData.Remove("way");

            gen.Insert(OpCodes.Ret);
        
        }

    }
}
